
<div class="x-body">
    <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so search-form">
            <input class="layui-input"  autocomplete="off" placeholder="开始日" name="date1"  value="{:input('date1')}" id="start">
            <input class="layui-input"  autocomplete="off" placeholder="截止日" name="date2"  value="{:input('date2')}" id="end">
            <input type="text" name="search_data"  placeholder="用户名|手机号" autocomplete="off" value="{:input('search_data')}"  class="layui-input">
            <div class="layui-input-inline">
                <select name="app_id">
                    <option value="" >全部应用</option>
                    {volist name='app_list' id='vo'}
                    <option value="{$vo['id']}" {notempty name="param['app_id']"}{if condition="$param['app_id'] eq $vo['id']"} selected="selected" {/if}{/notempty} >{$vo['name']}</option>
                    {/volist}
                </select>
            </div>
            <div class="layui-input-inline">
                <select name="status">
                    <option value="" >全部</option>
                    <option value="0" {notempty name="param['status']"}{if condition="$param['status'] eq 0"} selected="selected" {/if}{/notempty} >未付款</option>
                    <option value="1" {notempty name="param['status']"}{if condition="$param['status'] eq 1"} selected="selected" {/if}{/notempty}> 已付款</option>
                    <option value="2" {notempty name="param['status']"}{if condition="$param['status'] eq 2"} selected="selected" {/if}{/notempty}> 已发货</option>
                    <option value="-1" {notempty name="param['status']"}{if condition="$param['status'] eq -1"} selected="selected" {/if}{/notempty}> 已取消</option>
                </select>
            </div>
            <button class="layui-btn"  id="search"  url="{:url('applicationOrder')}"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
        </form>
    </div>
    <xblock>
        <!--<button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>批量删除</button>-->


    </xblock>
    <table class="layui-table x-admin">
        <thead>
        <tr>

            <th>序号</th>

            <th>会员账户</th>
            <th>手机号</th>
            <th>购买应用</th>
            <th>付款金额</th>
            <th>备注信息</th>
            <th>提交时间</th>
            <th>完成时间</th>
            <th>订单编号</th>
            <th>状态</th>
            <th>操作</th>
        </thead>
        {notempty name='list.list'}
        <tbody>
        {volist name='list.list' id='vo' key="k"}
        <tr>

            <td>{$k}</td>
            <td>
                <div><span>{$vo.username}</span></div>


            </td>
            <td>
                <div><span>{$vo.mobile|default='未绑定'}</span></div>


            </td>
            <td>
                <div><span>{$vo.app.name}</span></div>

            </td>

            <td>
                <div><span>{$vo.price}</span></div>


            </td>
            <td>
                <div><span>{$vo.remarks}</span></div>


            </td>
            <td>
                <div><span>{notempty name='vo.create_time'}{$vo.create_time}{/notempty}</span></div>


            </td>
            <td>
                <div><span>  {notempty name='vo.end_time'}{$vo.end_time|date='Y-m-d H:i:s', ###}{/notempty}</span></div>


            </td>
            <td>
                <div><span>{$vo.sn}</span></div>


            </td>
            <td>
                <div><span>
                    {switch name="vo.status"}
                        {case value="0"}待付款{/case}
                        {case value="1"}已付款{/case}
                        {case value="2"}已发货{/case}
                        {case value="-1"}已取消{/case}
                        {default /}default
                    {/switch}
                </span></div>


            </td>

            <td class="td-manage">
                <!--<a onclick="member_stop(this,'10001')" href="javascript:;"  title="启用">-->
                <!--<i class="layui-icon">&#xe601;</i>-->
                <!--</a>-->
                {if condition="$vo.status eq 1"}
                {if condition = "$vo.type eq 2"}
                <div style="margin-bottom: 5px;"><label></label><span>   <a title="会员卡发货" style="color: #0a8cd2"  href="{:url('applicationOrderConfirm', array('id' => $vo['id'],'status'=>2,'otcorder'=>1))}" >
                    发货
                </a></span></div>
                {else}
                <div style="margin-bottom: 5px;"><label></label><span>   <a title="发货" style="color: #0a8cd2"   href="javascript:reply({$vo.id},2);" >
                    发货
                </a></span></div>
                {/if}

                {/if}
                {if condition="$vo.status eq 1 ||  $vo.status eq 0 "}
                <div style="margin-bottom: 5px;"><label></label><span>   <a  title="取消订单"   style="color: #0a8cd2" href="javascript:reply({$vo.id},-1);">  取消</a></span></div>
                {/if}
            </td>
        </tr>
        {/volist}
        {else/}
        <tbody><tr class="odd"><td colspan="12" class="text-center" valign="top">{:config('empty_list_describe')}</td></tr></tbody>
        {/notempty}

        </tbody>
    </table>

    <div class="page">
        {notempty name='list.list'}   {$list['list']->render()}{/notempty}
    </div>
</div>
<script>
    layui.use('form', function(){
        form = layui.form;

    });
    layui.use('laydate', function(){
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });
    });

    function reply(id,state) {
        if(state==2){
            var title='发货'


        }else{
            var title='取消订单'
        }
        layer.open({
            type: 2 //此处以iframe举例
            ,title: title
            ,area: ['50%', '70%']
            ,shade: 0
            ,maxmin: true
            ,content: "applicationOrderConfirm?id="+id+'&status='+state+'&otcorder=1'
            ,btn: [] //只是为了演示
        });

    }
</script>

</body>

</html>


